/*
 * Email.cpp
 *
 *  Created on: 06/08/2012
 *      Author: Guilherme Branco
 *              filipe
 */
 /*----------------------------------*/
#include "Email.h"
#include "emailsValidos.h"
/*----------------------------------*/
Email::Email(string email)
{
    setValor(email);
}

void Email::validar(string email) throw(invalid_argument)
{
    EmailsValidos validados;
    validados.setValidos();
    size_t found = email.find_first_of("@");
    unsigned int flag = 0,i=0;
    string sub = email.substr(found,email.size());
    if(email.size()<3)
    {
        throw invalid_argument("E-mail invalido.");
    }
    if(!(validados.pesquisar(sub)))
    {
        throw invalid_argument("E-mail invalido.");
    }
}
